#include"common.h"
#include"HashTable.h"

class LZ77 {
public:
	LZ77();
	~LZ77();
	void CompressFile(string path);
	void UncompressFile(string path);
private:
	ush longestMatch(ush matchHead, ush& matchDist, ush start);
	void WriteFlagInfo(FILE* fFlag, ush matchLength, ush matchDist, uch& biteInfo, uch& bitCpint);
	void fillWindow(FILE* fin, ull& lookahead, ush& start);
	
private:
	uch* _pwin;
	HashTable _ht;
	const static ush MIN_LOOKAHEAD = MIN_MATCH + MAX_MATCH + 1;
	const static ush MAX_DIST = W_SIZE - MIN_LOOKAHEAD;
};